<template>
    <div>数字：{{ num }}</div>
    <button @click="add">+1</button>
    <button @click="dec">-1</button>
</template>
<script>
export default{
    data(){
        return{
            num:1,
        };
    },
    methods:{
        add(){
            this.num++;
        },
        dec(){
            this.num--;
        },
    },
};
</script>
<style>

</style>